package test;

import cglib.Buyer;
import cglib.CglibMethodInterceptor;
import net.sf.cglib.proxy.Enhancer;
import org.omg.CORBA.ARG_OUT;

/**
 * @Author:zimmor
 * @Date: 2021/3/28 12:51
 * @Description
 * @version: 1.0.0
 */

public class Demo1 {
    public static void main(String[] args) {
        Buyer buyer = new Buyer();
        buyer.buybuybuy();
        Enhancer enhancer = new Enhancer();
        enhancer.setCallback(new CglibMethodInterceptor());
        enhancer.setSuperclass(Buyer.class);
        Buyer proxy = (Buyer) enhancer.create();
        proxy.buybuybuy();
        for (int i = 0; i < 100; i++) {
            System.out.println("test");
            if(i==50) {
                System.out.println("i=50");
            }
        }
    }
}
